﻿/*!	@file	r_math_colorRGBi.h
	@brief	整数値色定義
Copyright (c) 2009 Yuya Yamaguchi

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
#ifndef _R_MATH_COLORRGBI_H_
#define _R_MATH_COLORRGBI_H_

#include "r_math_def.h"

namespace r{
	namespace math{
		struct ColorRGBf;


		//! 整数値カラー型インターフェース
		struct ColorRGBi {
		public:
			//! コンストラクタ
			ColorRGBi ( void );
			ColorRGBi ( r_ui32 color );
			ColorRGBi ( r_ui8 _r, r_ui8 _g, r_ui8 _b, r_ui8 _a );
			ColorRGBi ( r_ui8* _rgba );
			ColorRGBi ( const ColorRGBf& color );
			//! 演算子
			r_bool	operator == ( const ColorRGBi& src ) const;
			r_bool	operator != ( const ColorRGBi& src ) const;
			//! 各成分を足し合わせる
			ColorRGBi operator + ( const ColorRGBi &src ) const;
			const ColorRGBi &operator += ( const ColorRGBi &src );
			//! 各成分を掛け合わせる(掛け合わせて8bitシフトします)
			ColorRGBi operator * ( const ColorRGBi &src ) const;
			const ColorRGBi &operator *= ( const ColorRGBi &src );
			//! 各成分に一律に引数srcを足し合わせる
			ColorRGBi operator + ( r_ui8 src ) const;
			const ColorRGBi &operator += ( r_ui8 src );
			//! 各成分に一律に引数srcを掛け合わせる(掛け合わせて8bitシフトします)
			ColorRGBi operator * ( r_ui8 src ) const;
			const ColorRGBi &operator *= ( r_ui8 src );
		public:
			union {
				struct {
					r_ui8	r;
					r_ui8	g;
					r_ui8	b;
					r_ui8	a;
				};
				r_ui8	rgba[4];
				r_ui32	col;
				r_ui8	c[4];
			};
		};
	}
}
#include "../rtti/r_rtti_reflection_typename.h"
namespace r{
	namespace rtti{
		//! r::math::ColorRGBi
		template<>
		static inline
		const r_cstr	getTypeNameStr<r::math::ColorRGBi>() {
			return _RST ( "r::math::ColorRGBi" );
		}
	}
}


#endif // _R_MATH_COLORRGBI_H_
